#ifndef __MUTEXLOCK_H__
#define __MUTEXLOCK_H__
#include <pthread.h>
#include "Noncopyable.hpp"

namespace  wd{


class MutexLock {

public:
    MutexLock();
    ~MutexLock();
    void lock();
    void unlock();
    pthread_mutex_t * getMutexLockPtr();
private:
    pthread_mutex_t _mutex;

};

class MutexLockGuard
{
public:
    MutexLockGuard(MutexLock & m)
    : _mutex(m)
    {
        _mutex.lock();
    }

    ~MutexLockGuard()
    {
        _mutex.unlock();
    }
private:
    MutexLock & _mutex;

};


}// end of namespace wd

#endif

